#-*- coding:utf-8 -*-
from random import randint
rounds = 1
counts = 0
count = 0
while True:
    print '开始猜数字游戏'
    print '这是第',rounds,'轮游戏'
    #生成随机数字
    target = randint(1,100)
    #比较数字
    bingo = False
    counts += count
    count = 0
    while bingo == False:
        print '请输入你猜的整数'
        num = int(input())
        count += 1
        if count >10:
            break
        else:
            if num > target:
                print '你猜的大了'
                continue
            elif num < target:
                print '你猜的小了'
                continue
            else:
                print '你猜对了'
                bingo = True
                rounds += 1
                print '你猜了',rounds,'轮，平均',counts/rounds, "次猜中"



